<?php

namespace App\Kuafu\Shop\Controller\Internal;

use App\Exceptions\CustomValidateException;
use App\Kuafu\Base\Controller\BaseController;
use App\Kuafu\Shop\Service\ShopCameraService;
use App\Kuafu\Shop\Validate\CameraValidate;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class CameraController extends BaseController
{
    /**
     * @param Request $request
     * @return JsonResponse
     * @throws CustomValidateException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function shopCamera(Request $request): JsonResponse
    {
        $params = CameraValidate::shopCameraValidate(
            $request->merge(["shopId" => $request->header("shopId", 0)])->all()
        );
        return $this->success(["list" => ShopCameraService::getShopCameraList($params->shopId)]);
    }
}
